#ifndef ENTITY_H
#define ENTITY_H

#include "EngineApi.h"
#include "Renderer.h"
#include "Vector3.h"

typedef D3DXMATRIX Matrix;

class ENGINE_API Entity
{
public:
   Entity(const std::string& name) : 
      m_position(0,0,0), m_rotation(0,0,0), m_scale(1,1,1),
      m_name(name), m_visible(true), m_boundingBoxEnable(false){}

   virtual void draw(Renderer* renderer);
   
   void Translate(Vector3 position) { m_position = position; }
   void Rotate(Vector3 rotation) { m_rotation = rotation; }
   void Scale(Vector3 scale) { m_scale = scale; }

   void Translate( float X = 0, float Y = 0, float Z = 0 ){ Translate( Vector3(X,Y,Z) ); }
   void Rotate( float X = 0, float Y = 0, float Z = 0 ) { Rotate( Vector3(X,Y,Z) ); }
   void Scale( float X = 1, float Y = 1, float Z = 1 ) { Scale( Vector3(X,Y,Z) ); }

   Vector3 getPosition() { return m_position; }
   Vector3 getRotation() { return m_rotation; }
   Vector3 getScale() { return m_scale; }

   void setName(std::string name) { m_name = name; }
   std::string getName() { return m_name; }

   void setVisible( bool visible ) { m_visible = visible; }
   bool isVisible() { return m_visible; }

   void setMooving( bool isMooving ) { m_mooving = isMooving; }
   bool isMooving() { return m_mooving; }

   virtual void update(float deltaTime);

   std::string getCollisionGroup() { return m_collisionGroup; }
   void setCollisionGroup( std::string collisionGroup ) { m_collisionGroup = collisionGroup; }

   virtual void onCollision(Entity* collider){ /*std::cout << "collision\n";*/ }

   void setBoundingBoxVisible( bool enable ) { m_boundingBoxEnable = enable; }
   bool isBoundingBoxVisible(){ return m_boundingBoxEnable; }

protected:
   Vector3 m_position;
   Vector3 m_rotation;
   Vector3 m_scale;

private:
   
   Vector3 m_prevPosition;

   std::string m_name;
   bool m_visible;
   bool m_mooving;

   std::string m_collisionGroup;

   bool m_boundingBoxEnable;
};

#endif//ENTITY_H